module.exports = (db) => {
    const { INTEGER, STRING, CHAR, BIGINT, BOOLEAN } = require('sequelize').Sequelize
    const User = db.define('users', {
        id: {
            type: INTEGER.UNSIGNED,
            primaryKey: true,
            allowNull: false,
            autoIncrement: true,
            unique: true,
            comment: '用户ID',
        },
        origin_id: {
            type: STRING(100),
            allowNull: false,
            comment: '源用户ID',
            defaultValue: ''
        },
        username: {
            type: STRING(100),
            allowNull: false,
            comment: '用户名',
            defaultValue: ''
        },
        password: {
            type: CHAR(64),
            allowNull: false,
            comment: '用户密码',
            defaultValue: ''
        },
        avatar: {
            type: STRING(200),
            allowNull: false,
            comment: '用户头像',
            defaultValue: '/picture/head_img/00335c52040e53e0d2d4b33e3415bdae.jpg'
        },
        is_admin: {
            type: BOOLEAN,
            allowNull: false,
            comment: '是否为管理员',
            defaultValue: 0
        },
        created_at: {
            type: BIGINT.UNSIGNED,
            allowNull: false,
            comment: '用户注册时间',
        },
        last_logined_at: {
            type: BIGINT.UNSIGNED,
            allowNull: false,
            comment: '用户最后一次登录时间',
        }
    }, {
        timestamps: false,
    });
    return User;
}